package com.ruoyi.system.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.core.domain.entity.QueryDict;
import com.ruoyi.common.core.domain.entity.SysDic;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.system.mapper.SysDicMapper;
import com.ruoyi.system.service.ISysDicService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author linxz
 * @since 2024-12-25
 */
@Service
public class SysDicServiceImpl extends ServiceImpl<SysDicMapper, SysDic> implements ISysDicService {
    @Override
    public List<SysDic> fetchList(QueryDict query) {
        String bsName=query.getBsName();
        if(StringUtils.isEmpty(bsName)){
            // 查询所有
            return baseMapper.fetchList();
        }else {
            // 根据业务名称查询
            return baseMapper.fetchListByBsName(bsName);
        }

//        QueryWrapper<SysDic> queryWrapper = new QueryWrapper<>();
//        return baseMapper.selectList(queryWrapper);

    }

    @Override
    public int add(SysDic sysDic) {
        return baseMapper.add(sysDic);
    }

    @Override
    public int update(SysDic sysDic) {
        return baseMapper.update(sysDic);
    }

    @Override
    public int delete(int id) {
        return baseMapper.delete(id);
    }


}
